(defun factorial (n)
  (if (<= n 1) 1
      (* n (factorial (1- n)))))

(defun combination-repetition (n r)
  (/ (factorial n) (factorial r) (factorial (- n r))))

;;;;;;;;;;;;
(defun p53-1 ()
  (length
  (remove-if (lambda (x) (< x (expt 10 6)))
    (loop for n from 23 to 100
          append (loop for r from 1 to n
                       collect (combination-repetition n r))))))
(defun p53-2 ()
  (loop for n from 23 to 100
        sum (loop for r from 1 to n
                  when (> (combination-repetition n r) (expt 10 6))
                  sum 1)))

(format t "~a~%" (time (p53-1)))
(format t "~a~%" (time (p53-2)))
